Skip to content

Validate image.source: registry requires a tag; warn on tag: latest - #552

Open
RonaldHensbergen wants to merge 1 commit into
mainfrom
feat/validate-image-source-tag
Open

Validate image.source: registry requires a tag; warn on tag: latest#552
RonaldHensbergen wants to merge 1 commit into
mainfrom
feat/validate-image-source-tag

Conversation

@RonaldHensbergen

Copy link
Copy Markdown
Owner

Resolves #533.

Summary

config.image.source: registry (e.g. modules/orchestration/dagster) needs
config.image.tag set to something pullable, but a plain JSON Schema
configSchema can't express "tag is required only when source is registry"
as a cross-field constraint. This adds validate_image_source_config() in
cli/validator.py to enforce it directly, wired into validate_loaded_profile
alongside the existing contract-binding/observability checks.

  1. config.image.source: registry without config.image.tag (missing or
    empty string) → new error E103.
  2. config.image.tag: "latest" under source: registry → new warning
    W097 (the profile still validates — this nudges toward pinned,
    reproducible versions per Allow modules to pull published images instead of always building locally #407's goal, matching the version scheme
    publish-images.yml already publishes).
  3. config.image.source: build (the default) is unaffected — no new
    diagnostics for the existing local-build path.
  4. Documented both codes in README.md's error-code reference table,
    matching the existing E1xx/W0xx entries' style.

Testing

  • New ImageSourceConfigValidationTest in tests/test_validator.py:
    missing tag (error), empty-string tag (error), pinned tag (valid),
    tag: latest (warning, not error), source: build default path
    (unaffected), and a full validate_profile() run through a real
    module.yaml + profile.yaml fixture confirming tag: latest produces a
    warning with zero errors.
  • Manually validated against the real
    modules/orchestration/dagster/module.yaml: no image config → clean,
    tag: latestW097 only, pinned tag → clean, empty tag → E103.
  • python -m unittest discover -s tests -p "test_*.py" -v — full suite,
    all pass.
  • make lint — clean.

…ource: registry

Adds validate_image_source_config(), a new cross-field check that runs
whenever a module instance's resolved config.image.source is "registry":
- config.image.tag missing or empty -> error E103 (there'd be nothing to
  pull).
- config.image.tag == "latest" -> warning W097 (validates, but discourages
  the drifting-latest tag in favor of a pinned, reproducible version).
- config.image.source: build (the default) is unaffected.

Documents both new codes in README.md's error-code reference table,
matching the existing E1xx/W0xx entries' style.

Resolves #533.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Validate image.source: registry requires a tag; discourage tag: latest

1 participant